import Vue from "vue";
import Router from "vue-router";
import { menu } from "@/utils/menu";
Vue.use(Router);

/* Layout */
import Layout from "@/layout";
export let constantRoutes = [
    {
        path: "/index",
        component: Layout,
        redirect: "/index",
        meta: {
            title: "首页",
            icon: "icon-shouye"
        },
        children: [{
            hidden: true,
            path: "/index",
            name: "index",
            component: resolve => require(["@/views/index/index"], resolve),
            meta: {
                activeMenu: "/index",
            }
        }]
    },
    {
        path: "/cashier/cashier",
        component: Layout,
        redirect: "/cashier",
        meta: {
            title: "前台收银",
            icon: "icon-shouyin"
        },
        children: [{
            path: "/cashier",
            name: "cashier",
            component: resolve => require(["@/views/cashier/cashier"], resolve),
            meta: {
                activeMenu: "/cashier",
                title: "前台收银"
            },
            children: [
                {
                    hidden: true,
                    path: "/cashieraddMember",
                    name: "cashieraddMember",
                    component: resolve => require(["@/views/member/addMember"], resolve),
                    meta: {
                        activeMenu: "/cashier",
                        title: "开卡"
                    },
                },
                {
                    hidden: true,
                    path: "/setUserRecharge",
                    name: "setUserRecharge",
                    component: resolve => require(["@/views/cashier/setUserRecharge"], resolve),
                    meta: {
                        activeMenu: "/cashier",
                        title: "充值"
                    },
                }, {
                    hidden: true,
                    path: "/cashierMemberInfo",
                    name: "cashierMemberInfo",
                    component: resolve => require(["@/views/member/memberInfo"], resolve),
                    meta: {
                        title: "会员详情",
                        activeMenu: "/cashier"
                    }
                },
                {
                    hidden: true,
                    path: "/integralChage",
                    name: "integralChage",
                    component: resolve =>
                        require(["@/views/member/integralChage"], resolve),
                    meta: {
                        title: "积分变更",
                        activeMenu: "/cashier"
                    }
                },
            ]
        },
        {
            path: "/orderList",
            name: "orderList",
            component: resolve => require(["@/views/cashier/orderList"], resolve),
            meta: {
                activeMenu: "/orderList",
                title: "消费订单"
            },
            children: [{
                hidden: true,
                path: "/orderInfo",
                name: "orderInfo",
                component: resolve => require(["@/views/cashier/orderInfo"], resolve),
                meta: {
                    activeMenu: "/orderList",
                    title: "订单详情"
                },
            },
            {
                hidden: true,
                path: "/orderRefund",
                name: "orderRefund",
                component: resolve => require(["@/views/cashier/orderRefund"], resolve),
                meta: {
                    activeMenu: "/orderRefund",
                    title: "订单退款"
                },
            }]
        },
        {
            path: "/cardOpeningList",
            name: "cardOpeningList",
            component: resolve => require(["@/views/member/cardOpeningList"], resolve),
            meta: {
                activeMenu: "/cardOpeningList",
                title: "开卡列表"
            },
            children: [
                {
                    hidden: true,
                    path: "/addMember2",
                    name: "addMember2",
                    component: resolve =>
                        require(["@/views/member/addMember"], resolve),
                    meta: {
                        title: "新增会员",
                        activeMenu: "/cardOpeningList"
                    }
                },
            ]
        },
        ]
    },
    //会员管理
    {
        path: "/member/member",
        component: Layout,
        redirect: "/member",
        meta: {
            title: "会员管理",
            icon: "icon-huiyuan"
        },
        children: [{
            path: "/birthdayRember",
            name: "birthdayRember",
            component: resolve => require(["@/views/member/birthdayRember"], resolve),
            meta: {
                activeMenu: "/birthdayRember",
                title: "生日提醒"
            },
            children: [
                {
                    path: "/SmsDetails",
                    name: "SmsDetails",
                    hidden: true,
                    component: resolve => require(["@/views/member/SmsDetails"], resolve),
                    meta: {
                        activeMenu: "/birthdayRember",
                        title: "短信发送记录"
                    },
                }
            ]
        },
        {
            path: "/reminder",
            name: "reminder",
            component: resolve => require(["@/views/member/reminder"], resolve),
            meta: {
                activeMenu: "/reminder",
                title: "尾款提醒"
            }
        },
        {
            path: "/noArrive",
            name: "noArrive",
            component: resolve => require(["@/views/member/noArrive"], resolve),
            meta: {
                activeMenu: "/noArrive",
                title: "久未到店"
            }
        },
        {
            path: "/followUp",
            name: "followUp",
            component: resolve => require(["@/views/member/followUp"], resolve),
            meta: {
                activeMenu: "/followUp",
                title: "跟进回访"
            }
        },
        {
            path: "/member",
            name: "member",
            component: resolve => require(["@/views/member/member"], resolve),
            meta: {
                activeMenu: "/member",
                title: "会员列表"
            },
            children: [{
                hidden: true,
                path: "/memberInfo",
                name: "memberInfo",
                component: resolve =>
                    require(["@/views/member/memberInfo"], resolve),
                meta: {
                    title: "会员详情",
                    activeMenu: "/member"
                }
            },
            {
                hidden: true,
                path: "/addMember",
                name: "addMember",
                component: resolve =>
                    require(["@/views/member/addMember"], resolve),
                meta: {
                    title: "新增会员",
                    activeMenu: "/member"
                }
            },
            {
                hidden: true,
                path: "/integralChage",
                name: "integralChage",
                component: resolve =>
                    require(["@/views/member/integralChage"], resolve),
                meta: {
                    title: "积分变更",
                    activeMenu: "/member"
                }
            },
            ]
        },
        {
            path: "/referralList",
            name: "referralList",
            component: resolve => require(["@/views/member/referralList"], resolve),
            meta: {
                activeMenu: "/referralList",
                title: "转介绍列表"
            }
        },

        ]
    },
    {
        path: "/appointment/appointment",
        component: Layout,
        redirect: "/appointment",
        meta: {
            title: "预约管理",
            icon: "el-icon-timer"
        },
        children: [{
            path: "/appointments",
            name: "appointments",
            component: resolve => require(["@/views/appointment/appointment"], resolve),
            meta: {
                activeMenu: "/appointments",
                title: "新增预约"
            },
        },
        {
            path: "/appointmentList",
            name: "appointmentList",
            component: resolve => require(["@/views/appointment/appointmentList"], resolve),
            meta: {
                activeMenu: "/appointmentList",
                title: "预约列表"
            },
            children: [{
                path: "/appointmentInfo",
                name: "appointmentInfo",
                hidden: true,
                component: resolve => require(["@/views/appointment/appointment"], resolve),
                meta: {
                    activeMenu: "/appointmentList",
                    title: "预约详情"
                },
            }],
        },
            // {
            // 	path: "/appointmentInfo",
            // 	name: "appointmentInfo",
            // 	hidden: true,
            // 	component: resolve => require(["@/views/appointment/appointmentInfo"], resolve),
            // 	meta: {
            // 		activeMenu: "/appointmentInfo",
            // 		title: "预约详情"
            // 	},
            // },
        ]
    },
    {
        path: "/stock/stock",
        component: Layout,
        redirect: "/stock",
        meta: {
            title: "库存管理",
            icon: "icon-kucunguanli"
        },
        children: [{
            path: "/demandList",
            name: "demandList",
            component: resolve => require(["@/views/stock/demandList"], resolve),
            meta: {
                activeMenu: "/demandList",
                title: "要货单列表"
            },
            children: [{
                hidden: true,
                path: "/demandAdd",
                name: "demandAdd",
                component: resolve => require(["@/views/stock/demandAdd"], resolve),
                meta: {
                    activeMenu: "/demandList",
                    title: "新增要货单"
                },
            },
            {
                hidden: true,
                path: "/demandAddTwo",
                name: "demandAddTwo",
                component: resolve => require(["@/views/stock/demandAddTwo"], resolve),
                meta: {
                    activeMenu: "/demandList",
                    title: "新增要货单"
                },
            },
            {
                hidden: true,
                path: "/demandAddThree",
                name: "demandAddThree",
                component: resolve => require(["@/views/stock/demandAddThree"], resolve),
                meta: {
                    activeMenu: "/demandList",
                    title: "新增要货单"
                },
            },
            {
                hidden: true,
                path: "/demandInfo",
                name: "demandInfo",
                component: resolve => require(["@/views/stock/demandInfo"], resolve),
                meta: {
                    activeMenu: "/demandList",
                    title: "要货单详情"
                },
            },
            {
                hidden: true,
                path: "/demandInfoTwo",
                name: "demandInfoTwo",
                component: resolve => require(["@/views/stock/demandInfoTwo"], resolve),
                meta: {
                    activeMenu: "/demandList",
                    title: "要货单详情"
                },
            },
            {
                hidden: true,
                path: "/demandInfoThree",
                name: "demandInfoThree",
                component: resolve => require(["@/views/stock/demandInfoThree"], resolve),
                meta: {
                    activeMenu: "/demandList",
                    title: "要货单详情"
                },
            }
            ]
        },
        {
            path: "/salesreturn",
            name: "salesreturn",
            component: resolve => require(["@/views/stock/salesreturn"], resolve),
            meta: {
                activeMenu: "/salesreturn",
                title: "退货单列表"
            },
            children: [{
                hidden: true,
                path: "/salesreInfo",
                name: "salesreInfo",
                component: resolve => require(["@/views/stock/salesreInfo"], resolve),
                meta: {
                    activeMenu: "/salesreturn",
                    title: "退货单详情"
                },
            }]
        },
        {
            path: "/goodsBeput",
            name: "goodsBeput",
            component: resolve => require(["@/views/stock/goodsBeput"], resolve),
            meta: {
                activeMenu: "/goodsBeput",
                title: "商品入库"
            },
            children: [{
                hidden: true,
                path: "/goodsBeputInfo",
                name: "goodsBeputInfo",
                component: resolve => require(["@/views/stock/goodsBeputInfo"], resolve),
                meta: {
                    activeMenu: "/goodsBeput",
                    title: "新增入库单"
                },
            }]
        },
        {
            path: "/goodsDelivery",
            name: "goodsDelivery",
            component: resolve => require(["@/views/stock/goodsDelivery"], resolve),
            meta: {
                activeMenu: "/goodsDelivery",
                title: "商品出库"
            },
            children: [{
                hidden: true,
                path: "/goodsDeliveryInfo",
                name: "goodsDeliveryInfo",
                component: resolve => require(["@/views/stock/goodsDeliveryInfo"], resolve),
                meta: {
                    activeMenu: "/goodsDelivery",
                    title: "新增出库单"
                },
            }]
        },
        {
            path: "/goodsAllot",
            name: "goodsAllot",
            component: resolve => require(["@/views/stock/goodsAllot"], resolve),
            meta: {
                activeMenu: "/goodsAllot",
                title: "商品调拨"
            },
            children: [{
                hidden: true,
                path: "/goodsAllotInfo",
                name: "goodsAllotInfo",
                component: resolve => require(["@/views/stock/goodsAllotInfo"], resolve),
                meta: {
                    activeMenu: "/goodsAllot",
                    title: "新增调拨单"
                },
            }]
        },
        {
            path: "/stockTaking",
            name: "stockTaking",
            component: resolve => require(["@/views/stock/stockTaking"], resolve),
            meta: {
                activeMenu: "/stockTaking",
                title: "库存盘点"
            },
            children: [{
                hidden: true,
                path: "/stockTakingInfo",
                name: "stockTakingInfo",
                component: resolve => require(["@/views/stock/stockTakingInfo"], resolve),
                meta: {
                    activeMenu: "/stockTaking",
                    title: "新增盘点"
                },
            },
            {
                hidden: true,
                path: "/stockTakingDetail",
                name: "stockTakingDetail",
                component: resolve => require(["@/views/stock/stockTakingDetail"], resolve),
                meta: {
                    title: "盘点详情",
                    activeMenu: "/stockTaking",
                },
            },
            ]
        },
        {
            path: "/requisition",
            name: "requisition",
            component: resolve => require(["@/views/stock/requisition"], resolve),
            meta: {
                activeMenu: "/requisition",
                title: "领用单列表"
            },
            children: [
                {
                    hidden: true,
                    path: "/requisitionInfo",
                    name: "requisitionInfo",
                    component: resolve => require(["@/views/stock/requisitionInfo"], resolve),
                    meta: {
                        activeMenu: "/requisition",
                        title: "新增领用单"
                    },
                },
                {
                    hidden: true,
                    path: "/requisitionDetail",
                    name: "requisitionDetail",
                    component: resolve => require(["@/views/stock/requisitionDetail"], resolve),
                    meta: {
                        activeMenu: "/requisition",
                        title: "领用单详情"
                    },
                },
            ]
        },
        {
            path: "/skuDetailReport",
            name: "skuDetailReport",
            component: resolve => require(["@/views/stock/skuDetailReport"], resolve),
            meta: {
                activeMenu: "/skuDetailReport",
                title: "商品库存明细"
            },
        },
        ]
    },
    {
        path: "/goods/commodityManagement",
        component: Layout,
        redirect: "/commodityManagement",
        meta: {
            title: "商品管理",
            icon: "el-icon-takeaway-box"
        },
        children: [
            {
                path: "/commodityManagement",
                name: "commodityManagement",
                component: resolve => require(["@/views/goods/commodityManagement"], resolve),
                meta: {
                    activeMenu: "/commodityManagement",
                    title: "商品管理"
                },
                children: [
                    {
                        hidden: true,
                        path: "/commodityManagementInfo",
                        name: "commodityManagementInfo",
                        component: resolve => require(["@/views/goods/commodityManagementInfo"], resolve),
                        meta: {
                            title: "标准成品要货",
                            activeMenu: "/commodityManagement",
                        },
                    },
                ],
            }
        ]
    },
    {
        path: "/pointsMall/pointsMall",
        component: Layout,
        redirect: "/pointsMall",
        meta: {
            title: "积分商城",
            icon: "icon-jifenshangcheng"
        },
        children: [{
            path: "/order",
            name: "order",
            component: resolve => require(["@/views/pointsMall/order"], resolve),
            meta: {
                activeMenu: "/order",
                title: "订单列表"
            },
            children: [{
                hidden: true,
                path: "/orderInfos",
                name: "orderInfos",
                component: resolve => require(["@/views/pointsMall/orderInfos"], resolve),
                meta: {
                    activeMenu: "/order",
                    title: "订单详情"
                },
            }]
        },
        {
            path: "/goodsList",
            name: "goodsList",
            component: resolve => require(["@/views/pointsMall/goodsList"], resolve),
            meta: {
                activeMenu: "/goodsList",
                title: "商品列表"
            },
            children: [{
                hidden: true,
                path: "/goodsInfo",
                name: "goodsInfo",
                component: resolve => require(["@/views/pointsMall/goodsInfo"], resolve),
                meta: {
                    activeMenu: "/goodsList",
                    title: "商品详情"
                },
            },
            {
                hidden: true,
                path: "/goodsDetail",
                name: "goodsDetail",
                component: resolve => require(["@/views/pointsMall/goodsDetail"], resolve),
                meta: {
                    activeMenu: "/goodsList",
                    title: "商品兑换"
                },
            },


            ]
        },
        {
            path: "/serviceConfig",
            name: "serviceConfig",
            component: resolve => require(["@/views/pointsMall/projectList"], resolve),
            meta: {
                activeMenu: "/serviceConfig",
                title: "积分兑换服务次数",
            },
        },
        {
            path: "/goodsComment",
            name: "goodsComment",
            component: resolve => require(["@/views/pointsMall/goodsComment"], resolve),
            meta: {
                activeMenu: "/goodsComment",
                title: "商品评论"
            },
            children: [{
                hidden: true,
                path: "/goodsCommentInfo",
                name: "goodsCommentInfo",
                component: resolve => require(["@/views/pointsMall/goodsCommentInfo"], resolve),
                meta: {
                    activeMenu: "/goodsComment",
                    title: "评价详情"
                },
            }]
        },
        ]
    },
    {
        path: "/report/memberReport/returnReport",
        component: Layout,
        redirect: "/returnReport",
        meta: {
            title: "报表分析",
            icon: "el-icon-data-line"
        },
        children: [{
            path: "/memberReport",
            component: resolve => require(["@/views/report/index"], resolve),
            redirect: "/returnReport",
            meta: {
                title: "会员报表",
            },
            children: [{
                path: "/qualityReport",
                name: "qualityReport",
                component: resolve => require(["@/views/report/memberReport/qualityReport"], resolve),
                meta: {
                    activeMenu: "/qualityReport",
                    title: "优质会员分析"
                },
            },
            {
                path: "/cardReport",
                name: "cardReport",
                component: resolve => require(["@/views/report/memberReport/cardReport"], resolve),
                meta: {
                    activeMenu: "/cardReport",
                    title: "会员卡变更记录"
                },
            },
            {
                path: "/returnReport",
                name: "returnReport",
                component: resolve => require(["@/views/report/memberReport/returnReport"], resolve),
                meta: {
                    activeMenu: "/returnReport",
                    title: "回访记录"
                },
            },
            {
                path: "/feedbackReport",
                name: "feedbackReport",
                component: resolve => require(["@/views/report/memberReport/feedbackReport"], resolve),
                meta: {
                    activeMenu: "/feedbackReport",
                    title: "反馈列表"
                },
                children: [{
                    hidden: true,
                    path: "/feedbackReportInfo",
                    name: "feedbackReportInfo",
                    component: resolve => require(["@/views/report/memberReport/feedbackReportInfo"], resolve),
                    meta: {
                        title: "反馈详情",
                        activeMenu: "/feedbackReport"
                    }
                }]
            },
            ]
        },
        {
            path: "/warehouseReport",
            component: resolve => require(["@/views/report/index"], resolve),
            redirect: "/inReport",
            meta: {
                title: "仓储报表",
            },
            children: [{
                path: "/inReport",
                name: "inReport",
                component: resolve => require(["@/views/report/warehouseReport/inReport"], resolve),
                meta: {
                    activeMenu: "/inReport",
                    title: "入库报表"
                },
            },
            {
                path: "/outReport",
                name: "outReport",
                component: resolve => require(["@/views/report/warehouseReport/outReport"], resolve),
                meta: {
                    activeMenu: "/outReport",
                    title: "出库报表"
                },
            },
            {
                path: "/inventoryReport",
                name: "inventoryReport",
                component: resolve => require(["@/views/report/warehouseReport/inventoryReport"], resolve),
                meta: {
                    activeMenu: "/inventoryReport",
                    title: "盘点统计报表"
                },
            },
            ]
        },
        {
            path: "/financeReport",
            component: resolve => require(["@/views/report/index"], resolve),
            redirect: "/financeReport",
            meta: {
                title: "财务报表",
            },
            children: [
                {
                    path: "/expenditure",
                    name: "expenditure",
                    component: resolve => require(["@/views/report/financeReport/expenditure"], resolve),
                    meta: {
                        activeMenu: "/expenditure",
                        title: "开支列表"
                    },
                },
                {
                    path: "/expenseOtherReport",
                    name: "expenseOtherReport",
                    component: resolve => require(["@/views/report/financeReport/expenseOtherReport"], resolve),
                    meta: {
                        activeMenu: "/expenseOtherReport",
                        title: "代垫款列表"
                    },
                },
                {
                    path: "/remittanceList",
                    name: "remittanceList",
                    component: resolve => require(["@/views/report/financeReport/remittanceList"], resolve),
                    meta: {
                        activeMenu: "/remittanceList",
                        title: "汇款列表"
                    },
                },
                {
                    path: "/incomeStatement",
                    name: "incomeStatement",
                    component: resolve => require(["@/views/report/financeReport/incomeStatement"], resolve),
                    meta: {
                        activeMenu: "/incomeStatement",
                        title: "收入报表"
                    },
                },
                {
                    path: "/payrollReport",
                    name: "payrollReport",
                    component: resolve => require(["@/views/report/financeReport/payrollReport"], resolve),
                    meta: {
                        activeMenu: "/payrollReport",
                        title: "工资报表"
                    },
                },
                {
                    path: "/revenueReport",
                    name: "revenueReport",
                    component: resolve => require(["@/views/report/financeReport/revenueReport"], resolve),
                    meta: {
                        activeMenu: "/revenueReport",
                        title: "营收利润表"
                    },
                },
                {
                    path: "/profitReport",
                    name: "profitReport",
                    component: resolve => require(["@/views/report/financeReport/profitReport"], resolve),
                    meta: {
                        activeMenu: "/profitReport",
                        title: "利润分析报表"
                    },
                },
                {
                    path: "/dayReport",
                    name: "dayReport",
                    component: resolve => require(["@/views/report/financeReport/dayReport"], resolve),
                    meta: {
                        activeMenu: "/dayReport",
                        title: "日报表汇总"
                    },
                },
                {
                    path: "/dataReport",
                    name: "dataReport",
                    component: resolve => require(["@/views/report/financeReport/dataReport"], resolve),
                    meta: {
                        activeMenu: "/dataReport",
                        title: "数据分析表"
                    },
                },
                {
                    path: "/shipmentSummary",
                    name: "shipmentSummary",
                    component: resolve => require(["@/views/report/financeReport/shipmentSummary"], resolve),
                    meta: {
                        activeMenu: "/shipmentSummary",
                        title: "总部发货门店汇总"
                    },
                },
            ]
        },
        {
            path: "/reception",
            component: resolve => require(["@/views/report/index"], resolve),
            redirect: "/ortherVipDetail",
            meta: {
                title: "前台报表",
            },
            children: [{
                path: "/ortherVipDetail",
                name: "ortherVipDetail",
                component: resolve => require(["@/views/report/reception/ortherVipDetail"], resolve),
                meta: {
                    activeMenu: "/ortherVipDetail",
                    title: "异店会员本店明细"
                },
            },
            {
                path: "/vipDetail",
                name: "vipDetail",
                component: resolve => require(["@/views/report/reception/vipDetail"], resolve),
                meta: {
                    activeMenu: "/vipDetail",
                    title: "本店会员异店明细"
                },
            },
            {
                path: "/integralUpdateDetail",
                name: "integralUpdateDetail",
                component: resolve => require(["@/views/report/reception/integralUpdateDetail"], resolve),
                meta: {
                    activeMenu: "/integralUpdateDetail",
                    title: "积分变更记录"
                },
            },
            {
                path: "/rechargeRecord",
                name: "rechargeRecord",
                component: resolve => require(["@/views/report/reception/rechargeRecord"], resolve),
                meta: {
                    activeMenu: "/rechargeRecord",
                    title: "充值记录"
                },
            },
            ]
        },
        ]
    },
    {
        path: "/staff/staff",
        component: Layout,
        redirect: "/staff",
        meta: {
            title: "员工管理",
            icon: "icon-yuangongguanli"
        },
        children: [{
            path: "/staff",
            name: "staff",
            component: resolve => require(["@/views/staff/staff"], resolve),
            meta: {
                activeMenu: "/staff",
                title: "员工列表"
            },
            children: [{
                hidden: true,
                path: "/addStaff",
                name: "addStaff",
                component: resolve =>
                    require(["@/views/staff/addStaff"], resolve),
                meta: {
                    title: "新增员工",
                    activeMenu: "/staff"
                }
            },
            {
                hidden: true,
                path: "/staffInfo",
                name: "staffInfo",
                component: resolve =>
                    require(["@/views/staff/staffInfo"], resolve),
                meta: {
                    title: "员工详情",
                    activeMenu: "/staff"
                }
            },
            ]
        },
        {
            path: "/commissionCount",
            name: "commissionCount",
            component: resolve => require(["@/views/staff/commissionCount"], resolve),
            meta: {
                activeMenu: "/commissionCount",
                title: "业绩提成汇总"
            },
        },
        {
            path: "/commissionDetail",
            name: "commissionDetail",
            component: resolve => require(["@/views/staff/commissionDetail"], resolve),
            meta: {
                activeMenu: "/commissionDetail",
                title: "业绩提成明细"
            },
        },
        {
            path: "/voidDetails",
            name: "voidDetails",
            component: resolve => require(["@/views/staff/voidDetails"], resolve),
            meta: {
                activeMenu: "/voidDetails",
                title: "业绩提成作废退款明细"
            },
        },


        ]
    },

    {
        path: "/dataSetting/dataSetting",
        component: Layout,
        redirect: "/dataSetting",
        meta: {
            title: "数据设置",
            icon: "icon-huabanfuben"
        },
        children: [
            {
                path: "/projectList",
                name: "projectList",
                component: resolve => require(["@/views/dataSetting/projectList"], resolve),
                meta: {
                    activeMenu: "/projectList",
                    title: "服务项目列表"
                }
            },
            {
                path: "/projectComment",
                name: "projectComment",
                component: resolve => require(["@/views/dataSetting/projectComment"], resolve),
                meta: {
                    activeMenu: "/projectComment",
                    title: "项目评论列表"
                },
                children: [
                    {
                        hidden: true,
                        path: "/projectCommentInfo",
                        name: "projectCommentInfo",
                        component: resolve => require(["@/views/pointsMall/goodsCommentInfo"], resolve),
                        meta: {
                            activeMenu: "/projectList",
                            title: "评价详情"
                        },
                    }
                ]
            },
        ]
    },
    {
        //通告管理
        path: "/noticeManagement/noticeList",
        component: Layout,
        redirect: "/noticeList",
        meta: {
            title: "通告管理",
            icon: "el-icon-message",
        },
        children: [
            {
                path: "/noticeList",
                name: "noticeList",
                component: resolve => require(["@/views/noticeManagement/noticeList"], resolve),
                meta: {
                    activeMenu: "/noticeList",
                    title: "通告列表",
                },
                children: [
                    {
                        hidden: true,
                        path: "/noticeInfo",
                        name: "noticeInfo",
                        component: resolve => require(["@/views/noticeManagement/noticeInfo"], resolve),
                        meta: {
                            title: "通告详情",
                            activeMenu: "/noticeList",
                        },
                    },
                ],
            },
        ],
    },
];

let arr = JSON.parse(localStorage.getItem('menuInfo'))
if (arr) {
    constantRoutes = menu(constantRoutes, arr)
    // constantRoutes = [];
    // console.log(constantRoutes, arr);
}
// 不需要权限页面
export let asyncRoutes = [
    {
        path: "/login",
        component: resolve => require(["@/views/login/index"], resolve),
        hidden: true,
    },
    {
        path: "/404",
        component: resolve => require(["@/views/404"], resolve),
        hidden: true,
    },
    {
        path: "/",
        redirect: constantRoutes[0] ? constantRoutes[0].path : '/404',
        hidden: true,
    },
    // 404 page must be placed at the end !!!
    {
        path: "*",
        redirect: "/404",
        hidden: true,
    },
];
const createRouter = () =>
    new Router({
        // mode: 'history', // require service support
        scrollBehavior: () => ({
            y: 0
        }),
        routes: constantRoutes.concat(asyncRoutes)
    });

const router = createRouter();

// Detail see: https://github.com/vuejs/vue-router/issues/1234#issuecomment-357941465
export function resetRouter() {
    const newRouter = createRouter();
    router.matcher = newRouter.matcher; // reset router
}

export default router;